# Author:: Alexandre Ribeiro de Souza (<alexandre@lumis.com.br>)

=begin
unless File.exists?(node['lumis']['ebs']['device'])
  ::Chef::Recipe.send(:include, Opscode::Aws::Ec2)
  
  aws = data_bag_item("aws", "knife-user")
  
  aws_ebs_volume "lumis_ebs_volume" do
    aws_access_key aws['aws_access_key_id']
    aws_secret_access_key aws['aws_secret_access_key']
    size node['lumis']['ebs']['size']
    device node['lumis']['ebs']['device']
    action [ :create, :attach ]
  end
  
  unless File.exists?(node['lumis']['ebs']['mount_dir'])
    execute "format #{node['lumis']['ebs']['device']}" do
      command "/sbin/mkfs.ext4 #{node['lumis']['ebs']['mount_device']}"
    end
  end
end
=end

directory "/mnt/ephemerous" do
  group "root"
  owner "root"
  mode "0755"
end

mount "/mnt/ephemerous" do
  device "/dev/xvdj"
  fstype "ext4"
  options "defaults,noatime"
  action [:mount, :enable]
end

directory node['lumis']['ebs']['mount_dir'] do
  group "root"
  owner "root"
  mode "0755"
end

mount node['lumis']['ebs']['mount_dir'] do
  device node['lumis']['ebs']['mount_device']
  fstype "ext4"
  options "defaults,noatime"
  action [:mount, :enable]
end
